<template>
    <Row :gutter="40">
           <Col :span="8">
           <Form.Item label="名称：">
               <Input v-model:value="formData.name" placeholder="请填写名称" />
           </Form.Item>
           </Col>
           <Col :span="8">
           <Form.Item label="描述：">
               <Input v-model:value="formData.description" placeholder="请填写描述" />
           </Form.Item>
           </Col>
           <Col :span="8">
           <Form.Item label="脚本语言：">
               <Select :options="options" v-model:value="formData.scriptLanguage" placeholder="请选择脚本语言" ></Select>
           </Form.Item>
           </Col>
       </Row>
       <Row :gutter="40">
           <Col :span="8">
           <Form.Item label="脚本参数：">
               <Input v-model:value="formData.parameters" placeholder="请填写脚本参数"/>
           </Form.Item>
           </Col>
           <Col :span="8">
           <Form.Item label="脚本编译缓存：">
               <Switch v-model:checked="formData.cacheKey" />
           </Form.Item>
           </Col>
       </Row>

       <Form.Item label="脚本文件：">
           <UploadFile :show-url="formData.filename" @change="$event.file.response &&
                                (formData.filename =
                                    $event.file.response.data)">
           <Button>{{ !!formData.filename ? '已上传' : '未上传' }} </Button>
       </UploadFile>
       </Form.Item>

       <Form.Item label="脚本：">
           <Textarea  v-model:value="formData.script" :rows="6" placeholder="请填写脚本"  />

       </Form.Item>
</template>

<script lang="ts" setup>
import {
   Button,
   Form,
   Row,
   Col,
   Input,
   Textarea,
   Select,
   Switch
} from 'ant-design-vue'
import {
   type IStressCaseJSR223,
} from '~/types/apis/stress-case'


const formData = defineModel<IStressCaseJSR223>('formData', { required: true })

const options = [{
    value: 'jroovy',
    label:'jroovy'
},{
    value: 'java',
    label:'java'
},{
    value: 'beanshell',
    label:'beanshell'
},{
    value: 'bsh',
    label:'bsh'
},{
    value: 'jexl',
    label:'jexl'
},{
    value: 'jexl2',
    label:'jexl2'
}]

</script>

<style lang="scss" scoped></style>